import request from '@/config/axios'

export interface PublicityTypeVO {
  id: number
  typeNames: string
}

// 查询16个公示列表
export const getPublicityTypePage = async (params) => {
  return await request.get({ url: `/hutai/publicity-type/page`, params })
}

// 查询16个公示详情
export const getPublicityType = async (id: number) => {
  return await request.get({ url: `/hutai/publicity-type/get?id=` + id })
}
export const getPublicitySelectListByTypesName = async (id: number) => {
  return await request.get({ url: `/hutai/publicity-type/getPublicitySelectListByTypesName?id=` + id })
}

// 查询列表
export const getPublicityTypeList = async () => {
  return await request.get({ url: `/hutai/publicity-type/list`})
}

// 新增16个公示
export const createPublicityType = async (data: PublicityTypeVO) => {
  return await request.post({ url: `/hutai/publicity-type/create`, data })
}

export const testTijiao = async (data) => {
  return await request.post({ url: `/hutai/client/allocationAgent`, data })
}

// 修改16个公示
export const updatePublicityType = async (data: PublicityTypeVO) => {
  return await request.put({ url: `/hutai/publicity-type/update`, data })
}

// 删除16个公示
export const deletePublicityType = async (id: number) => {
  return await request.delete({ url: `/hutai/publicity-type/delete?id=` + id })
}

// 导出16个公示 Excel
export const exportPublicityType = async (params) => {
  return await request.download({ url: `/hutai/publicity-type/export-excel`, params })
}


// 获得公示表类目
export const getPublicitySelectList = async (id: number) => {
  return await request.get({ url: `/hutai/publicity-type/getPublicitySelectListByTypesName?id=` + id })
}

// 获得公示表详情
export const getListxq = async (id: number , type: number) => {
  return await request.get({ url: `/hutai/product-access-item/list?id=` + id +'&publicityTypeId='+type })
}

export const getPublicitySelectListByClassName = async (id: number) => {
  return await request.get({ url: `/hutai/formula/get/`+id})
}
export const saveData = async (data: PublicityTypeVO) => {
  return await request.post({ url: `/hutai/product-access-item/saveBatch`, data })
}
